package model;

import java.io.Serializable;
import java.math.BigDecimal;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import lombok.Builder;
import lombok.Getter;
import lombok.ToString;

@ToString
@Builder(prefix = "com", exclude = { "idPaciente", "serialVersionUID"})
@Table(name = "classificacao")
@Entity
public class Classificacao implements Serializable {
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long idClassificacao;
	private static final long serialVersionUID = 1L;
	private String metodo;
	private BigDecimal valor;
	private String condicao;

    @ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="idPaciente2")
	private Paciente idPaciente2;

	public Long getIdClassificacao() {
		return idClassificacao;
	}

	public void setIdClassificacao(Long idClassificacao) {
		this.idClassificacao = idClassificacao;
	}

	public String getMetodo() {
		return metodo;
	}

	public void setMetodo(String metodo) {
		this.metodo = metodo;
	}

	public BigDecimal getValor() {
		return valor;
	}

	public void setValor(BigDecimal valor) {
		this.valor = valor;
	}

	public String getCondicao() {
		return condicao;
	}

	public void setCondicao(String condicao) {
		this.condicao = condicao;
	}

	@Builder.Extension(fields = { "valor" })
	private void comValor(double valorDouble) {
		valor = new BigDecimal(Double.valueOf(valorDouble)).setScale(1,
				BigDecimal.ROUND_UP);
	}
}